package com.time.sky.controller;

import com.time.sky.entity.Market;
import com.time.sky.mapper.MarketMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@CrossOrigin
public class MarketController {
    @Autowired
    private MarketMapper marketMapper;

    @RequestMapping("queryMarket")
    public List<Market> queryMarket (Market m){
       return  marketMapper.queryMarket(m);
    }
    @RequestMapping("addMarket")
    public void addMarket(Market market){
        marketMapper.addMarket(market);
    }
    @RequestMapping("deleteMarket")
    public void  deleteMarket(int id){
        marketMapper.deleteMarket(id);
    }
    @RequestMapping("updateMarket")
    public void  updateMarket(Market market){
        marketMapper.updateMarket(market);
    }
    @RequestMapping("/getCountMarket")
    public int getCountMarket(Market market){
        return marketMapper.getCountMarket(market);

    }
}
